package com.ge.healthcare.autosc.common.createrfs.test;

import java.util.List;

import com.ge.med.service.eds.commons.DataException;
import com.ge.med.service.eds.commons.ResourceException;
import com.ge.med.service.eds.rfs.IRFS;
import com.ge.med.service.eds.rfs.IRFSCreateRequestVO;
import com.ge.med.service.eds.rfs.IRFSCreateResponseVO;
import com.ge.med.service.eds.rfs.vo.LogDetails;
import com.ge.med.service.eds.rfs.vo.RFSDetails;
import com.ge.med.service.eds.rfs.vo.RFSDetailsResponse;
import com.ge.med.service.eds.rfs.vo.RFSList;
import com.ge.med.service.eds.rfs.vo.RFSResponse;
import com.ge.med.service.eds.rfs.vo.RFSResponseCAPS;
import com.ge.med.service.eds.rfs.vo.RFSSearchCriteria;
import com.ge.med.service.eds.rfs.vo.RFSTechLogDetails;
import com.ge.med.service.eds.rfs.vo.ServiceRecord;
import com.ge.med.service.eds.rfs.vo.ServiceSearchRequest;
import com.ge.med.service.eds.rfs.vo.ServiceUpdateRequest;
import com.ge.med.service.eds.rfs.vo.ServiceUpdateResponse;
import com.ge.med.service.eds.rfs.vo.SystemHistory;

public class MockIRFS implements IRFS{

    private RFSResponseCAPS respVO;
    private boolean throwDataException;
    private boolean returnNull;
    private RuntimeException runtimeEx;
    private boolean throwResourceException;
    private RFSList[] rfsList;
    private boolean throwDataExceptionDuringSearch;
    private boolean throwResourceExceptionDuringSearch;
    private int errorCode;
    private String errorMsg;

    public void setThrowDataException(boolean b) {
        throwDataException = b;
    }

    public void setReturnNull(boolean b) {
        returnNull = b;
    }

    public void setExceptionToThrow(RuntimeException ex) {
        runtimeEx = ex;
    }

    public void setThrowResourceException(boolean b) {
        throwResourceException = b;
    }

    public void setThrowResourceExceptionDuringSearch(boolean b) {
        throwResourceExceptionDuringSearch = b;
    }

    public void setRFSList(RFSList[] list) {
        rfsList = list;
    }

    
    public void setRFSResponseCAPS(RFSResponseCAPS vo) {
        respVO = vo;
    }

    public void setThrowDataExceptionDuringSearch(boolean b, String message) {
        throwDataExceptionDuringSearch = b;
        errorMsg = message;
    }
    
    public void setThrowDataExceptionDuringSearch(boolean b) {
        setThrowDataExceptionDuringSearch(b, "Test DataException");
    }
    
    
    public RFSList[] searchBySystemIdDateRange(RFSSearchCriteria arg0) throws ResourceException, DataException {
        
        if (throwDataExceptionDuringSearch){
            DataException e = new DataException(0, errorMsg);
            
            throw e;
        }
        if (throwResourceExceptionDuringSearch){
            throw new ResourceException(0, "Test ResourceException");
        }
        
        if (rfsList == null){
            return new RFSList[0];            
        }else{
            return rfsList;
        }

    }

    
    public IRFSCreateResponseVO create(IRFSCreateRequestVO arg0) throws ResourceException, DataException {
        if (throwDataException){
            throw new DataException(0, "Test DataException");
        }
        if (throwResourceException){
            throw new ResourceException(0, "Test ResourceException");
        }
        if (returnNull){
            return null;
        }
        
        if (runtimeEx != null){
            throw runtimeEx;
        }
        RFSResponseCAPS respVO = new RFSResponseCAPS();
        respVO.setRFSNumber("ABC-123");
        return respVO;
    }
    
    
    public void asynchronousCreate(RFSDetails arg0, int arg1) throws ResourceException, DataException {
        
    }

    public RFSResponse create(RFSDetails arg0) throws ResourceException, DataException {
        return null;
    }


    public LogDetails[] getCoordinatorLog(String arg0, String arg1) throws ResourceException, DataException {
        return null;
    }

    public RFSDetailsResponse getDetails(String arg0, String arg1) throws ResourceException, DataException {
        return null;
    }

    public SystemHistory[] getSystemHistory(RFSSearchCriteria arg0) throws ResourceException, DataException {
        return null;
    }

    public LogDetails[] getTechLog(String arg0, String arg1) throws ResourceException, DataException {
        return null;
    }

    public RFSList[] searchByArea(RFSSearchCriteria arg0) throws ResourceException, DataException {
        return null;
    }


    public RFSResponse update(RFSDetails arg0) throws ResourceException, DataException {
        return null;
    }

    public RFSResponse updateTechLog(RFSTechLogDetails arg0) throws ResourceException, DataException {
        return null;
    }

	public ServiceUpdateResponse update(ServiceUpdateRequest arg0)
			throws ResourceException, DataException {
		// TODO Auto-generated method stub
		return null;
	}

	public List<ServiceRecord> search(ServiceSearchRequest arg0)
			throws ResourceException, DataException {
		// TODO Auto-generated method stub
		return null;
	}

	public String getDSRootDirectory(String arg0, String arg1)
			throws DataException, ResourceException {
		// TODO Auto-generated method stub
		return null;
	}




}
